package com.yczlab.mybatis.service;

import com.yczlab.mybatis.dao.EmployeeDao;
import com.yczlab.mybatis.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class EmployeeService {
    @Autowired
    private EmployeeDao employeeDao;

    public Employee findById(int employeeId) {
        return employeeDao.findById(employeeId);
    }

    public List<Employee> findByDepId(int depId) {
        return employeeDao.findByDepId(depId);
    }

    public Employee findEmpAndDept(Integer employeeId) {
        return employeeDao.findEmpAndDept(employeeId);
    }

    public Employee findEmpAndDeptStep(Integer employeeId) {
        return employeeDao.findEmpAndDeptStep(employeeId);
    }

    public Employee findByIdAndLastName(Integer employeeId, String lastName) {
        return employeeDao.findByIdAndLastName(employeeId, lastName);
    }

    public Employee findByMap(Map<String, Object> map){
        return employeeDao.findByMap(map);
    }

    public Map<String, Object> findByIdReturnMap(Integer employeeId) {
        return employeeDao.findByIdReturnMap(employeeId);
    }

    public Map<Integer, Employee> findEmpsReturnMap(String nameLike) {
        return employeeDao.findEmpsReturnMap(nameLike);
    }

    public List<Employee> findAll() {
        return employeeDao.findAll();
    }

    public List<Employee> findByLastName(String lastName) {
        return employeeDao.findByLastName(lastName);
    }

    public boolean addEmployee(Employee employee) {
        return employeeDao.addEmployee(employee);
    }

    public boolean updateEmployee(Employee employee){
        return employeeDao.updateEmployee(employee);
    }

    public boolean deleteEmployee(Integer employeeId) {
        return employeeDao.deleteEmployee(employeeId);
    }
}
